<template>
  <div>
    <ul class='list'>
      <li class='item' v-for="(item, key) in letters" :key="key" @click="handleLetterClick">
        {{item}}
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  props: {
    cities: Object
  },
  methods: {
    handleLetterClick(e) {
      this.$emit("change", e.target.innerText);
    }
  },
  computed: {
    letters() {
      const letter = [];
      for (let i in this.cities) {
        letter.push(i);
      }
      return letter
    }
  }
};
</script>

<style lang='stylus' scoped>
@import '~styles/varibles.styl';

.list {
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: absolute;
  top: 1.58rem;
  right: 0;
  bottom: 0;
  width: 0.4rem;

  .item {
    text-align: center;
    line-height: 0.4rem;
    color: $bgColor;
    cursor: pointer;
  }
}
</style>
